package com.bangcle.library.json;

import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

import android.os.Parcelable;

/***
 * Android平台有序Map结构
 * 
 * @author just
 */
public abstract class ParcelMap<K, V> implements Map<K, V>,Parcelable {
    private final Map<K, V> ref = Collections.synchronizedMap(new LinkedHashMap<K, V>());
    public ParcelMap() {
    }
    public void clear() {
        ref.clear();
    }
    public boolean containsKey(Object key) {
        return ref.containsKey(key);
    }
    public boolean containsValue(Object value) {
        return ref.containsValue(value);
    }
    public Set<Entry<K, V>> entrySet() {
        return ref.entrySet();
    }
    public V get(Object key) {
        return ref.get(key);
    }
    public boolean isEmpty() {
        return ref.isEmpty();
    }
    public Set<K> keySet() {
        return ref.keySet();
    }
    public V put(K key, V value) {
        return ref.put(key, value);
    }
    public void putAll(ParcelMap<K, V> map) {
        ref.putAll(map.ref);
    }
    public void putAll(Map<? extends K, ? extends V> map) {
        ref.putAll(map);
    }
    public V remove(Object key) {
        return ref.remove(key);
    }
    public int size() {
        return ref.size();
    }
    public Collection<V> values() {
        return ref.values();
    }
}
